package cn.ht.countDownLatchAndCyclicBarrierDemo;


import java.util.concurrent.CountDownLatch;

/**
 * @author ht
 * @Description:
 * @date 2020-5-21
 */
public class CountDownLatchDemo {

    public static Integer num = 6;

    public static void main(String[] args) throws InterruptedException {

        CountDownLatch countDownLatch = new CountDownLatch(num);
        for (int i = 1; i <= 6; i++) {
            new Thread(()->{
                System.out.println(Thread.currentThread().getName()+"\t下班，离开公司！");
                countDownLatch.countDown();
            },peopleEnum.getPeople(i).getMessage()).start();
    }
        countDownLatch.await();
        System.out.println(Thread.currentThread().getName()+"\t=======>主管下班，关门断电！");
    }

}
